﻿<%@ Control Language="C#" Inherits="Dimok.Web.UI.TableControlAjax" %>
<script runat="server">
	protected override void OnInit(EventArgs e) {
		WSEntityType = typeof(v_UploadInfo);
		ProfileID = "{8DDBAEE0-B895-4eb5-B1E5-34699CE70C8D}";
		ClientType = "motobankcorp.UploadInfos";
		RowContextMenu = cmUploadInfosRow;
		base.OnInit(e);
		dsInterestTypes.Selecting += new EventHandler<LinqDataSourceSelectEventArgs>(dsInterestTypes_Selecting);
		dsPaymentTypes.Selecting += new EventHandler<LinqDataSourceSelectEventArgs>(dsPaymentTypes_Selecting);
	}

	void dsPaymentTypes_Selecting(object sender, LinqDataSourceSelectEventArgs e) {
		e.Result = new MotoBank().ts_LoanPaymentTypes;
	}

	void dsInterestTypes_Selecting(object sender, LinqDataSourceSelectEventArgs e) {
		e.Result = new MotoBank().ts_InterestTypes;
	}
	protected override IEnumerable<ScriptDescriptor> GetScriptDescriptors() {
		var descriptors = base.GetScriptDescriptors().Cast<ScriptControlDescriptor>().ToDictionary(d => d.Type);
		var descriptor = descriptors[ClientType];
		descriptor.AddElementProperty("uploadButton", cmUploadInfosRow.Child("btnUploadFile").ClientID);
		descriptor.AddElementProperty("interestTypeList", cmUploadInfosRow.Child("selInterestType").ClientID);
		descriptor.AddElementProperty("paymentTypeList", cmUploadInfosRow.Child("selPaymentType").ClientID);
		descriptor.AddElementProperty("fileUpload", cmUploadInfosRow.Child("fileUpload").ClientID);
		return descriptors.Values.ToArray();
	}
	protected override IEnumerable<ScriptReference> GetScriptReferences() {
		var refs = base.GetScriptReferences().ToList();
		refs.Add(new ScriptReference("Dimok.Web.UI.JS.JQuery.ajaxfileupload.js", "Dimok.Web.UI"));
		return refs;
	}
</script>
<telerik:RadContextMenu ID="cmUploadInfosRow" Skin="Office2007" runat="server">
<Items>
	<telerik:RadMenuItem Text="Edit" Value="Edit"></telerik:RadMenuItem>
	<telerik:RadMenuItem IsSeparator="true"></telerik:RadMenuItem>
	<telerik:RadMenuItem Text="Upload" Value="UploadFile">
		<Items>
			<telerik:RadMenuItem>
				<ItemTemplate>
<%--					<form method="post" EncType="multipart/form-data" Action="/Manager/BayQuest/UploadBatch.aspx">--%>
					<input type="file" id="fileUpload" RunAt="server" />
					<div style="white-space:nowrap">
					<asp:DropDownList id="selInterestType" DataTextField="Name" DataValueField="ID" datasourceid="dsInterestTypes" RunAt="server" />
					<asp:DropDownList id="selPaymentType" DataTextField="Name" DataValueField="PaymentsPerYear" datasourceid="dsPaymentTypes" RunAt="server" />
					</div>
					<input type="button" value="Upload" id="btnUploadFile" RunAt="server" />
<%--					</form>--%>
				</ItemTemplate>
			</telerik:RadMenuItem>
		</Items>
	</telerik:RadMenuItem>
	<!-- #include virtual="/Controls/_UI/Telerik/RowContextMenuIncludes/Attachment.aspx" -->
	<telerik:RadMenuItem Text="Clear Accounts" Value="ClearAccounts" ToolTip="Remove all accounts from this upload" />
</Items>
</telerik:RadContextMenu>
<asp:LinqDataSource ID="dsInterestTypes" runat="server" />
<asp:LinqDataSource ID="dsPaymentTypes" runat="server" />